<?php

	include("bd/conexao/config.php"); // Arquivo de configuração MySQL

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>	Login </title>	

		<!-- ICON -->
		<link rel="icon" href="img/favicon-16.png" sizes="16x16">
		<link rel="icon" href="img/favicon-32.png" sizes="32x32">

		<!-- CSS -->	
		<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
		<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
		<link href="css/docs.min.css" rel="stylesheet" type="text/css">
		<link href="css/style.css" rel="stylesheet" type="text/css">
		<link href="http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300&amp;subset=latin,cyrillic-ext,vietnamese,cyrillic" rel="stylesheet" type="text/css">

	    <!-- SCRIPTS -->
		<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
		<script src="https://code.jquery.com/jquery.js"></script>	
		
		<!-- Include all compiled plugins (below), or include individual files as needed -->
	    <script src="js/bootstrap.min.js"></script>

	    <script>   	  	

	    	 $(document).ready(function() {    	 
				
	    		$("#form-login").submit(function() {

			   		var login = $('#login').val();
			   		var senha = $('#senha').val();

			   		$.post('scripts/confirm-login.php', 
			   		{
			   			txtLogin: login,
			   			txtSenha: senha	

			   		}, function(resposta) {		   		

			        	var resultado = resposta;		        	

			        	if (resultado == true) {			        	    
			        		$(window.document.location).attr('href','default.php');
			        		$('#login').val("");
		        		}
			        	else {
			        		$('#alerta-login').html('<strong>Senha: </strong> Alerta/Senha inválidos');
			        		$('#alerta-login').show();		        	

			        	    $('#login').focus(function() {
			        	    	$('#alerta-login').hide();

			        	    });
		        	    }		        	

			        });			       

			        return false;
			 
				});

			});

		</script>

	</head>

	<body>

		<div class="container">           
				
				<div class="img-logo">

					<a href="http://www.grupoorguel.com.br" title="Grupo Orguel"> 
			      		<img src="img/logo_orguel.png" class="center-block" />
			    	</a>			

		    	</div>	    	 		
			   
				<form role="form" id="form-login" class="login" method="post">

					<div class="bs-callout bs-callout-danger" id="alerta-login" style="display:none;"></div>	
									    
				    <input type="text" class="form-control" name="txtLogin" id="login" placeholder="Digite o login">	
						    
	    			<input type="password" class="form-control" name="txtSenha" id="senha" placeholder="Digite a senha">			
					 
						<button type="submit" class="btn btn-primary btn-lg btn-block" id="enviar">Login</button>

				</form>			 

	    </div> 				

	</body>

</html>